package com.itcms.core.repository;

import java.util.Collection;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import com.itcms.core.domain.NodeExt;
import com.itcms.core.domain.NodeExt.NodeExtId;

public interface NodeExtDao extends Repository<NodeExt, NodeExtId> {
	public NodeExt findOne(NodeExtId id);

	// --------------------

	@Modifying
	@Query("update NodeExt bean set bean.node.id=?2 where bean.node.id in (?1)")
	public int moveByNodeId(Collection<Integer> nodeIds, Integer nodeId);

	@Modifying
	@Query("delete from NodeExt bean where bean.nodeExt.id=?1")
	public int deleteByINodeExtId(Integer nodeExtId);

	@Modifying
	@Query("delete from NodeExt bean where bean.node.id=?1")
	public int deleteByNodeId(Integer nodeId);
}
